package com.cm.caseManagement.service.impl;

import com.cm.caseManagement.dao.CmLitigationMapper;
import com.cm.caseManagement.pojo.entity.CmLitigation;
import com.cm.caseManagement.service.ICmLitigationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cm.caseManagement.utils.DateUtils;

import java.util.List;

/**
 * 诉讼Service业务层处理
 *
 * @author ruoyi
 * @date 2025-10-05
 */
@Service
public class CmLitigationServiceImpl implements ICmLitigationService
{
    @Autowired
    private CmLitigationMapper cmLitigationMapper;

    /**
     * 查询诉讼
     *
     * @param id 诉讼主键
     * @return 诉讼
     */
    @Override
    public CmLitigation selectCmLitigationById(Long id)
    {
        return cmLitigationMapper.selectCmLitigationById(id);
    }

    /**
     * 查询诉讼列表
     *
     * @param cmLitigation 诉讼
     * @return 诉讼
     */
    @Override
    public List<CmLitigation> selectCmLitigationList(CmLitigation cmLitigation)
    {
        return cmLitigationMapper.selectCmLitigationList(cmLitigation);
    }

    /**
     * 新增诉讼
     *
     * @param cmLitigation 诉讼
     * @return 结果
     */
    @Override
    public int insertCmLitigation(CmLitigation cmLitigation)
    {
        cmLitigation.setCreateTime(DateUtils.getNowDate());
        return cmLitigationMapper.insertCmLitigation(cmLitigation);
    }

    /**
     * 修改诉讼
     *
     * @param cmLitigation 诉讼
     * @return 结果
     */
    @Override
    public int updateCmLitigation(CmLitigation cmLitigation)
    {
        cmLitigation.setUpdateTime(DateUtils.getNowDate());
        return cmLitigationMapper.updateCmLitigation(cmLitigation);
    }

    /**
     * 批量删除诉讼
     *
     * @param ids 需要删除的诉讼主键
     * @return 结果
     */
    @Override
    public int deleteCmLitigationByIds(Long[] ids)
    {
        return cmLitigationMapper.deleteCmLitigationByIds(ids);
    }

    /**
     * 删除诉讼信息
     *
     * @param id 诉讼主键
     * @return 结果
     */
    @Override
    public int deleteCmLitigationById(Long id)
    {
        return cmLitigationMapper.deleteCmLitigationById(id);
    }

    /**
     * 根据案件id查询诉讼信息
     * @param caseId
     * @return
     */
    @Override
    public CmLitigation selectCmLitigationByCaseId(Long caseId) {
        return cmLitigationMapper.selectCmLitigationByCaseId(caseId);
    }
}
